

function handleOne(msgsequence){
	var usersequence = $("#usersequence").val();
	$.ajax({
	   	 type : "post",
	        url : "/TeaCulture/applymsghandle/handle",
	        data : {"usersequence" : usersequence ,"msgsequence" : msgsequence},
	        dataType : "json",
	        traditional : true,
	        success : function(result){
	        	if(result.result.code === "1"){
		        	layer.msg("消息已处理！", {icon: 6});
	        	}else{
		        	layer.msg(result.result.des, {icon: 5});
	        	}
	        	location.reload();
	        },    
	        error : function(result){
	        	layer.msg(result.result.des, {icon: 5});
	        }
	   });
}
function disagreeOne(msgsequence,state){
	var usersequence = $("#usersequence").val();
	if(state == "1"){
		$.ajax({
		   	 type : "post",
		        url : "/TeaCulture/applymsghandle/disagree",
		        data : {"usersequence" : usersequence ,"msgsequence" : msgsequence},
		        dataType : "json",
		        traditional : true,
		        success : function(result){
		        	if(result.result.code === "1"){
			        	layer.msg("拒绝好友成功！", {icon: 6});
		        	}else{
			        	layer.msg(result.result.des, {icon: 5});
		        	}
		        	location.reload();
		        },    
		        error : function(result){
		        	layer.msg(result.result.des, {icon: 5});
		        }
		   });	
	}
	
}

function agreeOne(msgsequence,state){
	
	var usersequence = $("#usersequence").val();
	if(state == "1"){
		//这里需要注意的是，prompt有两个参数，前面是提示的话，后面是当对话框出来后，在对话框里的默认值  
		layer.prompt({
			  title: "请输入您要添加好友的备注", //提示框标题
			},function(value, index, elem){
			  layer.close(index);
			  if (value != "")//如果返回的有内容  
			    {  
		        	layer.msg("添加备注成功：" + value, {icon: 6});
			    }
			  $.ajax({
				   	 type : "post",
				        url : "/TeaCulture/applymsghandle/agree",
				        data : {"usersequence" : usersequence ,"msgsequence" : msgsequence, "remark" : value},
				        dataType : "json",
				        traditional : true,
				        success : function(result){
				        	if(result.result.code === "1"){
					        	layer.msg("添加好友成功！", {icon: 6});
				        	}else{
					        	layer.msg(result.result.des, {icon: 5});
				        	}
				        	location.reload();
				        },    
				        error : function(result){
				        	layer.msg(result.result.des, {icon: 5});
				        }
				   });
		});	
	}		
}


